SecureBridge demo support@devart.com
Readme  

The demo project demonstrates how to integrate the SecureBridge components with DAC to ensure secure connection to different SQL server through an SSH or SSL. This demo consists of two parts. The first part is a package that contains TCRSSHIOHandler and TCRSSLIOHandler components. These components provide integration with the SecureBridge library. The second part is two sample projects that demonstrate how to connect to xSQL server using SSL and SSH protocols, connect to the SSH server with SecureBridge by password or by public key, generate reliable random numbers, enable local port forwarding. These projects are located in the Demo\SSL and Demo\SSH subfolders.

Before opening the demo project, you should compile and install the dacsbridge package containing the TCRSSHIOHandler and TCRSSLIOHandler components. The following instruction will help you to compile and install this package.

Delphi and C++Builder for Win32

  1. Close all open projects in your IDE.
  2. Open the dacsbridgeXX.dpk run-time package (dacsbridgeXX.bpk for C++Builder).

    Location of this package depends on the version of your IDE:

    • Demos\Win32\TechnologySpecific\SecureBridge\Delphi5\ - for Delphi 5
    • Demos\Win32\TechnologySpecific\SecureBridge\Delphi6\ - for Delphi 6
    • Demos\Win32\TechnologySpecific\SecureBridge\Delphi7\ - for Delphi 7
    • Demos\Win32\TechnologySpecific\SecureBridge\Delphi10\ - for Delphi 2006
    • Demos\Win32\TechnologySpecific\SecureBridge\Delphi11\ - for Delphi 2007
    • Demos\Win32\TechnologySpecific\SecureBridge\Delphi12\ - for Delphi 2009
    • Demos\Win32\TechnologySpecific\SecureBridge\Delphi14\ - for Delphi 2010
    • Demos\Win32\TechnologySpecific\SecureBridge\Delphi15\ - for Delphi XE
    • Demos\Win32\TechnologySpecific\SecureBridge\Delphi16\ - for Delphi XE 2
    • Demos\Win32\TechnologySpecific\SecureBridge\Delphi17\ - for Delphi XE 3
    • Demos\Win32\TechnologySpecific\SecureBridge\Delphi18\ - for Delphi XE 4
    • Demos\Win32\TechnologySpecific\SecureBridge\Delphi19\ - for Delphi XE 5
    • Demos\Win32\TechnologySpecific\SecureBridge\Delphi20\ - for Delphi XE 6
    • Demos\Win32\TechnologySpecific\SecureBridge\Delphi21\ - for Delphi XE 7
    • Demos\Win32\TechnologySpecific\SecureBridge\Delphi22\ - for Delphi XE 8
    • Demos\Win32\TechnologySpecific\SecureBridge\Delphi23\ - for Delphi 10
    • Demos\Win32\TechnologySpecific\SecureBridge\CBuilder6\ - for C++Builder 6
  3. Compile the package.
  4. Open the dcldacsbridgeXX.dpk design-time package (dcldacsbridgeXX.bpk for C++Builder).

    Location of this package depends on the version of your IDE:

    • Demos\Win32\TechnologySpecific\SecureBridge\Delphi5\ - for Delphi 5
    • Demos\Win32\TechnologySpecific\SecureBridge\Delphi6\ - for Delphi 6
    • Demos\Win32\TechnologySpecific\SecureBridge\Delphi7\ - for Delphi 7
    • Demos\Win32\TechnologySpecific\SecureBridge\Delphi10\ - for Delphi 2006
    • Demos\Win32\TechnologySpecific\SecureBridge\Delphi11\ - for Delphi 2007
    • Demos\Win32\TechnologySpecific\SecureBridge\Delphi12\ - for Delphi 2009
    • Demos\Win32\TechnologySpecific\SecureBridge\Delphi14\ - for Delphi 2010
    • Demos\Win32\TechnologySpecific\SecureBridge\Delphi15\ - for Delphi XE
    • Demos\Win32\TechnologySpecific\SecureBridge\Delphi16\ - for Delphi XE 2
    • Demos\Win32\TechnologySpecific\SecureBridge\Delphi17\ - for Delphi XE 3
    • Demos\Win32\TechnologySpecific\SecureBridge\Delphi18\ - for Delphi XE 4
    • Demos\Win32\TechnologySpecific\SecureBridge\Delphi19\ - for Delphi XE 5
    • Demos\Win32\TechnologySpecific\SecureBridge\Delphi20\ - for Delphi XE 6
    • Demos\Win32\TechnologySpecific\SecureBridge\Delphi21\ - for Delphi XE 7
    • Demos\Win32\TechnologySpecific\SecureBridge\Delphi22\ - for Delphi XE 8
    • Demos\Win32\TechnologySpecific\SecureBridge\Delphi23\ - for Delphi 10
    • Demos\Win32\TechnologySpecific\SecureBridge\CBuilder6\ - for C++Builder 6
  5. Compile and install the package.
  6. Click Tools > Options > Environment Options > Delphi Options > Library. In the Library path field, specify the path to the directory containing the compiled packages.

TCRSSHIOHandler

TCRSSHIOHandler component description

TCRSSHIOHandler is a component that can be used by DAC to connect to a xSQL server through the secure connection. TCRSSHIOHandler is an implementation of the abstract class TCRIOHandler.

TCRSSHIOHandler creates a logical connection through an SSH tunnel and represents an interface for data exchange. The physical secure connection is provided by using the SSH Client.

This component requires the Client property to be set. This property determines the physical connection between SSH client and SSH server that is used for data exchange.
You can set this property at design time by selecting from the list of provided TScSSHClient objects. At run time, set the Client property to a reference of an existent TScSSHClient object. TScSSHClient is a component from SecureBridge library.

Note: Do not call methods of TCRSSHIOHandler directly, because they are called by DAC.

Below you will find descriptions of TCRSSHIOHandler properties.

property Client: TScSSHClient;
Determines the physical connection between SSH client and SSH server that is used for data exchange. To create a logical connection, the Client property must be set.
Set this property at design time by selecting from the list of provided TScSSHClient objects. At run time, set the Client property to a reference of an existent TScSSHClient object.

TCRSSLIOHandler

TCRSSLIOHandler component description

The TCRSSLIOHandler is a component that can be used by DAC to connect to a xSQL server through the secure connection. TCRSSLIOHandler is an implementation of the abstract class TCRIOHandler. TCRSSLIOHandler creates a logical connection through the SSL protocol and represents an interface for data exchange.

To protect the current connection with SSL, it is not enough just to link a TCRSSLIOHandler object to the TDAConnection object. You should also set the SSL mode to use SSL. If this option is not set, transferred data will not be encrypted.

This component is similar to TCRSSHIOHandler, but TCRSSLIOHandler requires no client component to be linked to, as functionality of an SSL client is embedded into TCRSSLIOHandler.

Note: Do not call methods of TCRSSLIOHandler directly, because they are called by DAC.

Below you will find descriptions of properties, and events of TCRSSLIOHandler (they are similar to ones of TScSSLClient)

property CACertName: string;
Specifies the server CA certificate name that is stored in Storage. CA certificate is used to authenticate the server through SSL. When authenticating an SSL server, from the server comes a certificate that must be signed by the specified CA certificate. If received certificate is not signed by the CA certificate, the Accept parameter will be set to False in the OnServerCertValidate. If the server certificate is signed by the CA certificate, Accept will be set to True in the OnServerCertValidate event.
If the certificate with the name specified in the CACertName is not found an exception will be raised.
property CertName: string;
Specifies the client certificate name that is stored in Storage. The client certificate to authenticate the client by the server. It must be signed by CACertName, and must have a private key (TScCertificate.Key.IsPrivate is set True).
If the specified certificate was no found in the storage, and the SSL server requires the client certificate for authentication, secure connection will not be established.
Note: If CertName is not specified, the certificate is searched by HostName.
property CipherSuites: TScSSLCipherSuites;
The CipherSuites property holds a list of acceptable algorithms that can be used for encrypting and support integrity of the data transferred between the client and the server through a secure connection.
property Storage: TScStorage;
This property is used to access certificate list in the linked storage. If Storage is not assigned, an exception will be raised on connect.
property OnServerCertValidate: TScServerCertValidate;
type

TScServerCertValidate = procedure(Sender: TObject; ServerCertificate: TScCertificate; var Accept: Boolean) of object;


Occurs when the server certificate is received from the server.
When authenticating an SSL server, from the server comes a certificate that must be signed by the specified CA certificate. If received certificate is not signed by the CA certificate, the Accept parameter will be set to False in the OnServerCertValidate. If the server certificate is signed by the CA certificate, Accept will be set to True in the OnServerCertValidate event. A handler of this event can perform additional verifications to authenticate the server. If you trust the server, set the Accept to True and the connection will be established.

Parameters:
Sender - the object that raised the event;
ServerCertificate - the server certificate received from the server;
Accept - when Accept is set to True, the server is considered valid, and the server authentication is successful. When Accept is set to False, the server is considered invalid and the connection is closed.

 

 


© 1997-2019 Devart. All rights reserved.